package com.acme.bankapp.service.bank;

import java.io.FileNotFoundException;
import java.io.IOException;

import com.acme.bankapp.domain.bank.Bank;
import com.acme.bankapp.mock.BankServer;

public class BankApplication {	
		
	public static void main(String[] args) throws ClassNotFoundException {
		
		int len = args.length;
		if(len != 3) {
			System.out.println("the wrong input data");
			return;
		}
		if (!args[0].equals("-loadbank") && !args[2].equals("-server")) {
			System.out.println("the wrong command");
			return;
		}
				
		Bank SberBank;		
		try {
			BankDataLoaderService bs = new BankDataLoaderService(args[1], args[1]);			
							
			SberBank = bs.readBank();
						
			BankServer server = new BankServer();
			server.startServer(SberBank);
						
		}
		catch (FileNotFoundException e) {
			System.out.println("feedfile does not exists");
			return;
		} catch (IOException e) {
			System.out.println("IOexception");
		}		
	}

}
